<% 
	var headContent = {
	include("/pages/template/head.html"){}
%>

<script type="text/javascript">
var oper;
jQuery(function($) {
	// 页面方法
	oper = {
		width : 400,
		height : 430,
		form : document.form1,
		list : function() {
			var url = 'folder/list';
			this.form.action = url;
			this.form.submit();
		},
		view : function(id) {
			var url = 'folder/view/'+id;
			var title = '查看目录';
			Iframe(url, this.width, this.height, title, false, false, false, EmptyFunc);
		},
		add : function() {
			var url = 'folder/add';
			var title = '添加目录';
			Iframe(url, this.width, this.height, title);
		},
		edit : function(id) {
			var url = 'folder/edit/'+id;
			var title = '修改目录';
			Iframe(url, this.width, this.height, title);
		},
		del : function(id) {
			var url = 'folder/delete/'+id;
			var title = '确认要删除该目录信息？';
			Confirm(title, function() {
				form1.action = url;
				form1.submit();
			});
		}
	};
	//显示Menu索引
	showMenu('page_folder');
});

//分页
var paginator = function(page) {
	oper.list();
};

</script>

<%
};

var bodyContent = {
%>
	<form name="form1" action="" method="post"  class="form-inline" role="form">
		<!-- 菜单 -->
		<% include("/static/component/include/menu.html"){} %>

		<div class="tableSearch">
			<%  //查询列表 %>
			<div class="form-group">
					<input class="form-control" type="text" name="attr.name" value="${attr.name!''}" 
						placeholder="请输入名称" required='required' />
			</div>
				<div class="form-group">
					<select name="attr.status" class="form-control" >
					<option value="-1">--请选择--</option>
					<% var status_data = '[{"key":"1","value":"显示"},{"key":"2","value":"隐藏"}]'; %>
					${flyfox.sel(status_data,attr.status!'')  }
					</select>
			</div>
	 
			
			<button type="button" class="btn btn-default" onclick="oper.list();" name="search">
			 		<span class="glyphicon glyphicon-search"></span> 查 询
			</button>
			<button type="button" class="btn btn-default" onclick="resetForm();">
			 		<span class="glyphicon glyphicon-refresh"></span> 重 置
			</button>
			<button type="button" class="btn btn-default" onclick="oper.add();">
			 		<span class="glyphicon glyphicon-plus"></span> 新 增
			</button>
		</div>
		
		<!-- 数据列表 -->
		<table class="table table-striped table-bordered table-hover">
			<thead>
				<tr>
					<th>序号</th>
					<%  // 列表头部 %>
					<th>编号</th>
					<th>名称</th> 
					<th>排序</th> 
					<th>状态</th> 
					<th>类型</th> 
					<th>地址</th> 
					<th>说明</th> 
 
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			<% for(item in page.list){ %>
				<tr>
					<td>${itemLP.index }</td>
					<%  // 列表内容 %>
					<td>${item.id}</td> 
					<td>${item.name}</td> 
					<td>${item.sort}</td>
					<% var status_data = '[{"key":"1","value":"显示"},{"key":"2","value":"隐藏"}]'; %>
					<td>${flyfox.radioValue(status_data,item.status!'')  }</td> 
					<td>${flyfox.dictValue(item.type!'' )  }</td>
							<td>${item.jump_url}</td> 
					<td title="${item.content}">
					<% if (strutil.length(item.content) > 6) { %>
						${strutil.subStringTo(item.content, 0, 6)}...
					<% 	} else { %>
						${item.content}
					<%  } %>
					</td> 
	 
					<td>
					<a href="javascript:void(0);" class="btn btn-sm btn-success" onclick="oper.view(${item.id});">查看</a> 
					<a href="javascript:void(0);" class="btn btn-sm btn-primary" onclick="oper.edit(${item.id});">修改</a> 
					<% if(item.id>1){ %>
					<a href="javascript:void(0);" class="btn btn-sm btn-danger" onclick="oper.del(${item.id});">删除</a>
					<% } %>
					</td>
				</tr>
			<% } %>
			</tbody>
		</table>
		<%include("/static/component/include/paginator.html"){} %>
	</form>
<%}; %>


<% layout("/pages/template/_layout.html",{head:headContent,body:bodyContent}){ %>
<%} %>